package com.sicaolong.myfunctionproject.flatmap;

import com.sicaolong.myfunctionproject.model.Player;
import com.sicaolong.myfunctionproject.model.PlayerBuilder;

import java.util.Arrays;
import java.util.List;

public class FlatMapTest {

    public static void main(String[] args) {
        List<Player> playerList = PlayerBuilder.buildPlayerList();
        playerList.stream()
                .flatMap(t -> t.getHeroList().stream())
                .distinct()
                .flatMap(t -> Arrays.stream(t.getCarrier().split(",")))
                .distinct()
                .forEach(System.out::println);
    }
}
